<!--<!DOCTYPE html>-->
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <title>商品详情</title>

    <link href="__PUBLIC__/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css"/>
    <link href="__PUBLIC__/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css"/>
    <link href="__PUBLIC__/basic/css/demo.css" rel="stylesheet" type="text/css"/>
    <link type="text/css" href="__PUBLIC__/css/optstyle.css" rel="stylesheet"/>
    <link type="text/css" href="__PUBLIC__/css/style.css" rel="stylesheet"/>

    <script type="text/javascript" src="__PUBLIC__/basic/js/jquery-1.7.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/basic/js/quick_links.js"></script>

    <script type="text/javascript" src="__PUBLIC__/AmazeUI-2.4.2/assets/js/amazeui.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/jquery.imagezoom.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/jquery.flexslider.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/list.js"></script>
    <script src="__PUBLIC__/js/global.js"></script>
    <script src="__PUBLIC__/layer/layer.js"></script>


    <style>

        .attr-list-hd h4 {
            position: relative;
            float: left;
            height: 35px;
            margin-bottom: -1px;
            padding-right: 10px;
            border-bottom: none;
            font-size: 14px;
        }

        .btn_shop {
            border: 1px solid #D6D6D6;
            background: #FFFFFF;
            line-height: 25px;
            font-size: 14px;
            color: #787878;
            width: 30px;
            height: 25px;
            text-align: center;
            vertical-align: middle;
            display: inline-block;
            margin-top: -5px;
        }
        .b1{
            line-height: 22px;
        }

        #comment_image li{
            float:left;
        }
    </style>

</head>

<include file="Public:wechat_share" />
<body>
<script src="https://qiyukf.com/script/47dc0b3bd13d942b2316143fd0d2777a.js" defer async></script>
<!--<header data-am-widget="header" class="am-header am-header-default am-header-fixed">-->
    <!--&lt;!&ndash;<div class="am-header-left am-header-nav">-->
        <!--<a href="#left-link" onclick="back()" class="">-->
            <!--<i class="am-header-icon am-icon-angle-left am-icon-sm" style="color: #FFAD01;"></i>-->
        <!--</a>-->
    <!--</div>&ndash;&gt;-->
    <!--<h1 class="am-header-title">-->
        <!--<a href="#title-link" class="">-->
            <!--商品详情-->
        <!--</a>-->
    <!--</h1>-->
<!--</header>-->
<input type="hidden" name="goods_id" id="goods_id" value="{$goodsData.goods_id}">
<input type="hidden" id="comment_pagenum_hidden" value="1">
<div class="listMain" style="margin-top: -21px;">

    <!--轮播图-->
    <div class="scoll">
        <assign  name="i" value="1">
        <section class="slider">
            <div class="flexslider" >
                <ul class="slides">
                    <volist name="imageData" id="image">
                        <li >
                            <img src="{$image.image_url}"  style="padding-top: 0;" <?php  if($i++ == 1) echo 'title="pic"' ?>/>
                        </li>
                    </volist>
                </ul>
            </div>
        </section>
    </div>




    <div class="item-inform">
        <div class="clearfixRight">

            <!--规格属性-->
            <!--名称-->
            <div class="tb-detail-hd">
                <h1>
                    {$goodsData.goods_name}
                </h1>
            </div>
            <div class="tb-detail-list">
                <!--价格-->
                <div class="tb-detail-price">
                    <li class="price iteminfo_price">

                        <dd style="margin-left: 5px;"><em>¥</em><span id="goods_price" class="sys_item_price"><?php if($user_type == 1) echo $goodsData['shop_price']-$agent_price; else echo $goodsData['shop_price'];?></span></dd>
                    </li>
                    <li class="price iteminfo_mktprice">
                        <dt>原价</dt>
                        <dd><em>¥</em><b class="sys_item_mktprice">{$goodsData['market_price']}</b></dd>
                    </li>
                    <div class="clear"></div>
                </div>

                <!--销量-->
                <ul class="tm-ind-panel">
                    <li class="tm-ind-item tm-ind-sellCount canClick">
                        <div class="tm-indcon"><span class="tm-label">月销量</span><span class="tm-count">{$goodsData.sales_month}</span></div>
                    </li>
                    <li class="tm-ind-item tm-ind-sumCount canClick">
                        <div class="tm-indcon"><span class="tm-label">累计销量</span><span class="tm-count">{$goodsData.sales_sum}</span>
                        </div>
                    </li>
                    <li class="tm-ind-item tm-ind-reviewCount canClick tm-line3">
                        <div class="tm-indcon"><span class="tm-label">累计评价</span><span class="tm-count">{$commentInfo.all}</span></div>
                    </li>
                </ul>
                <div class="clear"></div>

                <!--各种规格-->
                <dl class="iteminfo_parameter sys_item_specpara">
                    <dt class="theme-login">
                    <div id="spec_selected" class="cart-title">可选规格<span class="am-icon-angle-right"></span></div>
                    </dt>
                    <dd>
                        <!--操作页面-->

                        <div class="theme-popover-mask"></div>

                        <div class="theme-popover">
                            <div class="theme-span"></div>
                            <div class="theme-poptit">
                                <a href="javascript:;" title="关闭" id="close" class="close">×</a>
                            </div>
                            <div class="theme-popbod dform">
                                <form class="theme-signin" name="loginform" action="" method="post">
                                    <input type="hidden" id="type" value="">
                                    <div class="theme-signin-left">

                                        <foreach name="filter_spec"  item="vo" key="k">
                                        <div class="theme-options">
                                            <div class="cart-title">{$k}</div>
                                            <ul>
                                                <volist name="vo" id="vi">

                                                <li id="{$vi.item_id}" class="sku-line" style="    font-size: 15px;" onclick="change_spec(this.id, {$index})">{$vi.item}<i></i></li>
                                                </volist>
                                            </ul>
                                        </div>
                                            <input type="hidden" name="spec_filter[]" id="spec-<?php echo $index; ?>" value="">
                                            <?php $index++; ?>
                                        </foreach>

                                        <div class="theme-options">
                                            <div class="cart-title number">数量</div>

                    <dd>
                      <!--  <input id="min" class="am-btn am-btn-default" name="" type="button" value="-"/>
                        <input id="text_box"  name="" type="text" value="1" style="width:30px;"/>
                        <input id="add" class="am-btn am-btn-default" name="" type="button" value="+"/>-->
                    <div class="num am-fr" style="float: left;margin-right: 10px"><span class="reduc btn_shop b1" id="min">-</span>
                        <input id="text_box" class="btn_shop" name="goods_num[{$vo.id}]" type="text" value="1"/>
                        <span class="add btn_shop b1" id="add">+</span>
                    </div>
                        <span id="Stock" class="tb-hidden">库存<span id="goods_num" class="stock">{$goodsData.store_count}</span>件</span>
                    </dd>

            </div>
            <div class="clear"></div>

            <div class="btn-op">
                <a href="javascript:;" title="关闭"  onclick="cilckOk()" > <div class="btn am-btn am-btn-warning" id="ok" >确认</div></a>
                <div class="btn close am-btn am-btn-warning">取消</div>
            </div>
        </div>
        <div class="theme-signin-right">
            <div class="img-info" >
                <img id="spec-img" src="{$goodsData.original_img}"/>
            </div>
            <!--<div class="text-info">-->
                <!--<span class="J_Price price-now">¥39.00</span>-->
                <!--<span id="Stock" class="tb-hidden">库存<span class="stock">1000</span>件</span>-->
            <!--</div>-->
        </div>

        </form>
    </div>
</div>

</dd>
</dl>
<div class="clear"></div>
<!--活动	-->
<!--<div class="shopPromotion gold">
    <div class="hot">
        <dt class="tb-metatit">店铺优惠</dt>
        <div class="gold-list">
            <p>购物满2件打8折，满3件7折<span>点击领券<i class="am-icon-sort-down"></i></span></p>
        </div>
    </div>
    <div class="clear"></div>
    <div class="coupon">
        <dt class="tb-metatit">优惠券</dt>
        <div class="gold-list">
            <ul>
                <li>125减5</li>
                <li>198减10</li>
                <li>298减20</li>
            </ul>
        </div>
    </div>
</div>-->


<div class="pay">
    <div style="width: 30%;">
    <div style="width: 50%;float: left;padding: 3px 10px;" align="center" onclick="openKefu()">
        <img src="__PUBLIC__/new_images/kefu.png" alt="" style="width:29px;margin-top: 6px">
    </div>
    <div style="width: 50%;float: left;padding: 3px 10px;" align="center" onclick="collectGoods('{$goodsData.goods_id}')">
        <img src="__PUBLIC__/new_images/shoucang.png" alt="" style="width:29px;margin-top: 6px">
    </div>
    </div>

   <!-- <div class="pay-opt am-text-center" >ssss
        <a href="#" onclick="openKefu()"><span class="am-icon-home am-icon-fw " style="font-size:150%;color:#999999;margin-top: 5px;padding-top: 3px;"><br>
            <font size="1" style="display: block;margin-top: -3px;">客服</font>
        </span>
        </a>
     &lt;!&ndash;   <a onclick="collectGoods('{$goodsData.goods_id}')">
            <neq name="is_collect" value="true">
                <span class="am-icon-star-o am-icon-fw " id="collect_goods_span" style="font-size:150%;color:#999999;margin-top: 8px; "><br>
                    <font size="1" style="display: block;margin-top: -3px;color: #999;">收藏</font>
                 <else/><span class="am-icon-star-o am-icon-fw " id="collect_goods_span" style="font-size:150%;color:#FFAD01;margin-top: 8px; "><br>
                        <font size="1" style="display: block;margin-top: -3px;color: #FFAD01;">收藏</font>

            </neq>
        <a>&ndash;&gt;

            </span>
        </a>

    </div>-->

    <li >
        <div class="clearfix tb-btn tb-btn-buy ">
            <a id="LikBuy" title="点此按钮到下一步确认购买信息" onclick="checkConfirm(1)" >加入购物车</a>
        </div>
    </li>
    <li>
        <!--<div class="clearfix tb-btn tb-btn-basket theme-login" >-->
        <div class="clearfix tb-btn tb-btn-basket" >
            <a id="LikBasket" title="加入购物车"  onclick="checkConfirm(2)" style="background: #FFAD01"><i>立即购买</i></a>
        </div>
    </li>
</div>


<div class="introduce" style="padding-bottom: 5px">

    <div class="introduceMain">
        <div class="am-tabs" data-am-tabs="{noSwipe: 1}">
            <ul class="am-avg-sm-3 am-tabs-nav am-nav am-nav-tabs">
                <li class="am-active">
                    <a href="#">

                        <span class="index-needs-dt-txt">宝贝详情</span></a>

                </li>

                <li>
                    <a href="#">

                        <span class="index-needs-dt-txt">全部评价</span></a>

                </li>

                <li>
                    <a href="#">

                        <span class="index-needs-dt-txt">猜你喜欢</span></a>
                </li>
            </ul>

            <div class="am-tabs-bd">

                <div class="am-tab-panel am-fade am-in am-active am-text-left">
                    <!--<div class="attr-list-hd after-market-hd">-->
                        <!--<h4>商品细节</h4>-->
                    <!--</div>-->
                    <div class="J_Brand">

                        <!--<div class="attr-list-hd tm-clear">-->
                            <!--<h4>产品参数：</h4>-->
                            <!--</div>-->
                        <div style="line-height: 32px;
                        /*height:34px;*/
                        border-bottom: 1px dashed #d4d4d4;"></div>
                        <ul id="J_AttrUL" style="position: relative;padding: 0px 8px 34px;height: auto">

                            <volist name="attr_list" id="vo">
                                <!--<hr style="height:1px;border:none;border-top:1px dashed #0066CC;" />-->
                                <li class="l1" style="line-height: 32px;min-height: 34px;border-bottom: 1px dashed #d4d4d4;" title="">
                                    <span class="s1" style="color: #A9A9A9">{$attribute[$vo['attr_id']]}</span>
                                        <!--{$vo['attr_value']}-->
                                    <!--<div>-->
                                    <span class="s2" style="position: absolute;left: 100px;color: #636363;display: inline-block;white-space: normal;">{$vo['attr_value']}</span>
                                    <!--</div>-->
                                </li>
                                </li>
                                <!--<hr style="height:1px;border:none;border-top:1px dashed #0066CC;" />-->
                            </volist>
                        </ul>
                        <div class="clear"></div>
                    </div>
                    <div style="width: 100%;height:auto;" id="content"  >
                        {$goodsData.goods_content}
                    </div>

                        <!--<div class="details">-->
                            <!--&lt;!&ndash;<div class="attr-list-hd after-market-hd">&ndash;&gt;-->
                                <!--&lt;!&ndash;<h4>商品细节</h4>&ndash;&gt;-->
                            <!--&lt;!&ndash;</div>&ndash;&gt;-->
                            <!--<div class="twlistNews" id="content">-->
                                <!--{$goodsData.goods_content}-->
                            <!--</div>-->
                        <!--</div>-->
                </div>

                <div class="am-tab-panel am-fade " style="padding-left: 0;padding-right: 0;">

                    <div class="actor-new">
                        <div class="rate">
                            <strong>100<span>%</span></strong><br> <span>好评度</span>
                        </div>
                        <!--<dl>-->
                            <!--<dt>买家印象</dt>-->
                            <!--<dd class="p-bfc">-->
                                <!--<q class="comm-tags"><span>味道不错</span><em>(2177)</em></q>-->
                                <!--<q class="comm-tags"><span>颗粒饱满</span><em>(1860)</em></q>-->
                                <!--<q class="comm-tags"><span>口感好</span><em>(1823)</em></q>-->
                                <!--<q class="comm-tags"><span>商品不错</span><em>(1689)</em></q>-->
                                <!--<q class="comm-tags"><span>香脆可口</span><em>(1488)</em></q>-->
                                <!--<q class="comm-tags"><span>个个开口</span><em>(1392)</em></q>-->
                                <!--<q class="comm-tags"><span>价格便宜</span><em>(1119)</em></q>-->
                                <!--<q class="comm-tags"><span>特价买的</span><em>(865)</em></q>-->
                                <!--<q class="comm-tags"><span>皮很薄</span><em>(831)</em></q>-->
                            <!--</dd>-->
                        <!--</dl>-->
                    </div>
                    <div class="clear"></div>
                    <div class="tb-r-filter-bar">
                        <ul class=" tb-taglist am-avg-sm-4">
                            <li class="tb-taglist-li tb-taglist-li-current">
                                <div class="comment-info">
                                    <span>全部评价</span>
                                    <span class="tb-tbcr-num">({$commentInfo.all})</span>
                                </div>
                            </li>

                            <li class="tb-taglist-li tb-taglist-li-1">
                                <div class="comment-info">
                                    <span>好评</span>
                                    <span class="tb-tbcr-num">({$commentInfo.good})</span>
                                </div>
                            </li>

                            <li class="tb-taglist-li tb-taglist-li-0">
                                <div class="comment-info">
                                    <span>中评</span>
                                    <span class="tb-tbcr-num">({$commentInfo.mid})</span>
                                </div>
                            </li>

                            <li class="tb-taglist-li tb-taglist-li--1">
                                <div class="comment-info">
                                    <span>差评</span>
                                    <span class="tb-tbcr-num">({$commentInfo.bad})</span>
                                </div>
                            </li>
                        </ul>
                    </div>
                    <div class="clear"></div>
                 <div  id="comment_list">




                    </div>
                    <div class="clear"></div>

                    <!--<div class="tb-reviewsft">-->
                    <!--<div class="tb-rate-alert type-attention">购买前请查看该商品的 <a href="#" target="_blank">购物保障</a>，明确您的售后保障权益。-->
                    <!--</div>-->
                    <!--</div>-->

                </div>
                <!--猜你喜欢 -->
                <div class="am-tab-panel am-fade">
                    <div class="like">
                        <ul class="am-avg-sm-2 am-avg-md-3 am-avg-lg-4 boxes">
                            <volist name="sameGoods" id="goods">
                                <li>
                                    <div class="i-pic limit">
                                        <img src="{$goods.original_img}"/>
                                        <p>{$goods.goods_name}
                                            <!--<span>东北红松子奶油味</span></p>-->
                                        <p class="price fl">
                                            <b>¥</b>
                                            <strong>{$goods.shop_price}</strong>
                                        </p>
                                    </div>
                                </li>
                            </volist>
                        </ul>
                    </div>
                    <div class="clear"></div>

                    <!--分页 -->
                    <!--<ul class="am-pagination am-pagination-right">-->
                        <!--<li class="am-disabled"><a href="#">&laquo;</a></li>-->
                        <!--<li class="am-active"><a href="#">1</a></li>-->
                        <!--<li><a href="#">2</a></li>-->
                        <!--<li><a href="#">3</a></li>-->
                        <!--<li><a href="#">4</a></li>-->
                        <!--<li><a href="#">5</a></li>-->
                        <!--<li><a href="#">&raquo;</a></li>-->
                    <!--</ul>-->
                    <div class="clear"></div>

                </div>

            </div>

        </div>

        <div class="clear"></div>
    </div>
</div>
</div>

<script type="text/javascript" src="__PUBLIC__/jquery_lazyload/jquery.lazyload.js"></script>

</body>
<script type="text/javascript">
    var page=1; //当前页的页码
    var allpage =1; //总页码，会从后台获取
    $(function () {
        $(".l1").each(function(){
            var span1 = $(this).children().first();
            var span2 = $(this).children().last();
            if( span1.height() < span2.height()){
                $(this).css("height", span2.height()+"px");
            }
            else
                $(this).css("height", span1.height()+"px");
        });
//        clearCookie();
        getCommentListByPage(1);
    });
    function clearCookie(){
        var keys=document.cookie.match(/[^ =;]+(?=\=)/g);
        if (keys) {
            for (var i = keys.length; i--;)
                document.cookie=keys[i]+'=0;expires=' + new Date( 0).toUTCString()
        }
    }
    $(window).load(function () {
        $('.flexslider').flexslider({
            animation: "slide",
            start: function (slider) {
                $('body').removeClass('loading');
            }
        });


        $("#content p").find("img").width("100%");
        var height = 0;
        $("#content").find("p").each(function(index){

            height = height + $(this).children().height();
            console.log($(this).children().height());
        });

//        $("#content").height(height +"px");

        $("img").lazyload({
            threshold : 10
        });
//        getGoodsContent();

    });

    function scrollFn(){
        allpage = $('#totalpage').val();
        //真实内容的高度
        var pageHeight = Math.max(document.body.scrollHeight,document.body.offsetHeight);
        //视窗的高度
        var viewportHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0;
        //隐藏的高度
        var scrollHeight = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
        if(pageHeight - viewportHeight - scrollHeight < 20){  //如果满足触发条件，执行
            if(page <= allpage) {
                getCommentList();
            }
        }
    }
    $(window).bind("scroll",scrollFn);  //绑定滚动事件
    function getCommentListByPage(pagenum) {
        //提交form
        $('#comment_pagenum_hidden').val(pagenum);
        getCommentList();
    }
    function modalInfo(info,success){
        layer.msg(info);
//        if(success) {
//            layer.msg(info);
//        }else{
//            layer.msg(info, {icon: 2});
//        }

    }
    function collectGoods($goods_id){
        $.ajax({
            type: "POST",
            url: "__URL__/ajaxCollectGoods",
            data: {
                goods_id: $('#goods_id').val()
            },
            dataType: "json",
            success: function (data) {
                if(data.status == 1){
                    modalInfo(data.msg,true);
                    $('#collect_goods_span').css('color','#FFAD01');
                }else{
                    modalInfo(data.msg,false);
                }
            }
        });
    }
    function getCommentList() {
        $.ajax({
            type: "POST",
            url: "__URL__/commentList",
            async:false,
            data: {
                pagenum: page,
                goods_id: $('#goods_id').val(),
                type: 0,
            },
//            dataType: "json",
            success: function (data) {
//                console.info(data);
                page++;  //页数加1
                console.info('nextPage:'+page);
                $('#comment_pagenum_hidden').val(page);
                $('#comment_list').append(data);
                AMUI.gallery.init();
                $("img .lazy").lazyload();
            },
            error:function(data){


                console.info(data);
            }
        });
/*        function makePageHtml(data) {
            var html = '';
            if (data.page.pagenum == '1') {
                html += '<li class="am-disabled">';
            } else {
                html += '<li>';
            }
            html +='<a onclick="getCommentListByPage(' + data.page.startPage + ')">&laquo;</a></li>';
            for (var i = data.page.startPage; i <= data.page.endPage; i++) {
                if (data.page.pagenum == i) {
                    html += '<li  class="am-active"><a style="background-color: #FFAD01; border-color: #FFAD01;">' + i + '</a></li>';
                } else {
                    html += '<li ><a onclick="getCommentListByPage(' + i + ')">' + i + '</a></li>';
                }
            }
            if (data.page.pagenum == data.page.totalpage) {
                html += '<li class="am-disabled">';
                html += '<a href="#">&raquo;</a></li>';
            }else{
                html +='<li>';
                html += '<a onClick="getCommentListByPage(' + data.page.totalpage + ')">&raquo;</a></li>';
            }
            $('#comment_pagenum_hidden').val(data.page.pagenum);
            $('#comment_page_list').empty().append(html);
        }*/

    }
    function back() {
        if (/(iPhone|iPad|iPod)/i.test(navigator.userAgent)) {
            window.location.href = window.document.referrer;
        } else { window.history.go("-1"); }
    }





    function  change_spec(id, k){
        console.info(id + '      ' + k);
        var va  =  $('#spec-'+k).val();
        if(va == '')
            $('#spec-'+k).val(id);

        else if(va == id){
            $('#spec-'+k).val('');
        }
        else
            $('#spec-'+k).val(id);
        console.info('spec:'+ $('#spec-'+k).val() );
        get_goods_price();
    }



    var curr_price = '{$goods.shop_price}';
    var agent_price = {$agent_price};

    var user_type = '{$user_type}';
    function get_goods_price()
    {
        var goods_price = '{$goods.shop_price}'; // 商品起始价
        var store_count = '{$goods.store_count}'; // 商品起始库存
        var spec_goods_price = {$spec_goods_price};  // 规格 对应 价格 库存表   //alert(spec_goods_price['28_100']['price']);
        // 如果有属性选择项
        if(spec_goods_price != null)
        {
            goods_spec_arr = new Array();
            $("input[name^='spec_filter']").each(function(){
                goods_spec_arr.push($(this).val());
            });
            var spec_key = goods_spec_arr.sort(sortNumber).join('_');  //排序后组合成 key
//            console.info(spec_key);
//            spec_goods_price = eval(spec_goods_price);
            console.info(spec_goods_price[spec_key]);
            goods_price = spec_goods_price[spec_key].price; // 找到对应规格的价格
            store_count = spec_goods_price[spec_key]['store_count']; // 找到对应规格的库存
            console.info(spec_key);
        }
        var goods_num = parseInt($("#goods_num").val());
        // 库存不足的情况
        if(goods_num > store_count)
        {
            goods_num = store_count;
            alert('库存仅剩 '+store_count+' 件');
            $("#goods_num").val(goods_num);
        }

        var flash_sale_price = parseFloat("{$goods['flash_sale']['price']}");
        (flash_sale_price > 0) && (goods_price = flash_sale_price);
        if(user_type == 1)
            $("#goods_price").html(goods_price-agent_price); // 变动价格显示
        else
            $("#goods_price").html(goods_price); // 变动价格显示
        console.info($('#spec_selected').text());

        if(spec_goods_price[spec_key]['key_name'] != '')
            $('#spec_selected').text('已选择' + spec_goods_price[spec_key]['key_name']);
//        else
//            alert('111');

    }

    function sortNumber(a,b)
    {
        return a - b;
    }


/*
    function calculate_price(){

        var num = $('#text_box').val();

        if(num > 0){
            $("#goods_price").html(curr_price * num);
            console.info(num);
        }




    }*/

    function  checkConfirm(type){ //type为1时添加到购物车 2时直接购买

        var spec_goods_price = {$spec_goods_price}; //判断该商品是否有规格

        if(spec_goods_price != null) {
            $("input[name^='spec_filter']").each(function () {
                if ($(this).val() == '') {

                    if(type == 1)
                        $('#type').val(1);
                    else
                        $('#type').val(2);
                    $('#spec_selected').click();

                    return false;
                }
            });
        }

        if(spec_goods_price != null) //有规格情况下
            var spec_key = goods_spec_arr.sort(sortNumber).join('_');  //排序后组合成 key
        else //没有规格情况下
            var spec_key = null;
        if(type == 1) {
            addCart(spec_key);
        }

        else {

            submitPay(spec_key);

        }
    }



    function cilckOk(){
        var type = $('#type').val();
        var flag = 0;
        var spec_goods_price = {$spec_goods_price}; //判断该商品是否有规格
        if(spec_goods_price != null) {
            $("input[name^='spec_filter']").each(function () {
                if ($(this).val() == '') {
//                    $('#spec_selected').click();

                    console.info('dshadsa');
                    layer.msg('请选择规格');
                    flag = 1;
                    return false;
                }
            });
        }

        if(flag == 1)
            return;

        if(spec_goods_price != null) //有规格情况下
            var spec_key = goods_spec_arr.sort(sortNumber).join('_');  //排序后组合成 key

        else
            var spec_key = '';
        if(type == 1)//购物车
        {
            addCart(spec_key);
            $('#close').click();
        }
        else//立即购买
        {

            submitPay(spec_key);
            $('#close').click();
        }


    }

    function addCart(spec_key){
        $.ajax({
            type: "POST",
            url: "__APP__/Home/ShopCart/ajaxAddCart",

            data: {
                goods_id: $('#goods_id').val(),
                goods_num: $('#text_box').val(),
                goods_spec: spec_key,
            },
            error: function (data) {

                layer.msg('服务器错误');
                console.info(data);
                return;
            },
            success: function (data) {

                layer.msg(data.msg);
                console.info(data);
                $('#spec_selected');
//                window.location.href='__APP__/Home/ShopCart/index';
                return;

            }


        })

    }


    function  submitPay(spec_key){
        var temp = document.createElement("form");
//        temp.action = '__APP__/Home/ShopCart/shop2';
//        temp.method = "post";

        temp.id= 'goods_detail';
        temp.style.display = "none";
        var goods_id = document.createElement("input");
        goods_id.name = 'goods_id';
        goods_id.value = $('#goods_id').val();

        var goods_num = document.createElement("input");
        goods_num.name = 'goods_num';
        goods_num.value = $('#text_box').val();


        var spec_key1 = document.createElement("input");
        spec_key1.name = 'goods_spec';
        spec_key1.value = spec_key;


        var type2 = document.createElement("input");
        type2.name = 'type';
        type2.value = 2;

        // alert(opt.name)
        temp.appendChild(goods_id);
        temp.appendChild(goods_num);
        temp.appendChild(spec_key1);
        temp.appendChild(type2);
        document.body.appendChild(temp);
    /*    temp.submit();
        return temp;*/


        var formData = new FormData(document.getElementById('goods_detail'));

        $.ajax({
            type:"post",
            url:"__APP__/Home/ShopCart/shop2",
            data : formData,
            processData: false,
            contentType: false,
            error:function (data) {
                console.info(data);
                layer.msg('服务器繁忙');

            },
            success:function (data) {

                console.info(data);
                layer.msg(data.msg);
                if(data.status >= 0){

                    window.location.href = 'http://www.jipintc.com/Home/ShopCart/shop3?order_id=' + data.order_id;

                }

            }
        });

    }


    function  openKefu(){
        console.info(ysf)
        ysf.product({
            show : 1, // 1为打开， 其他参数为隐藏（包括非零元素）
            title : '{$goodsData['goods_name']}',
            desc : '{$goodsData['goods_remark']}',
            picture : 'http://www.jipintc.com/{$goodsData['original_img']}',
            note : '备注',
            url : 'http://www.jipintc.com/__URL__/introduction?goods_id={$goodsData['goods_id']}'
        });
        ysf.open();

    }
</script>
</html>